<?php
 
class myTools
{
  public static function stripText($text)
  {
    $text = strtolower($text);
 
    // strip all non word chars
    $text = preg_replace('/\W/', ' ', $text);
 
    // replace all white space sections with a dash
    $text = preg_replace('/\ +/', '-', $text);
 
    // trim dashes
    $text = preg_replace('/\-$/', '', $text);
    $text = preg_replace('/^\-/', '', $text);
 
    return $text;
  }
  
  public static function dateDiff($dformat, $endDate, $beginDate)
  {
    $date_parts1=explode($dformat, $beginDate);
    $date_parts2=explode($dformat, $endDate);
    //gregoriantojd($month, $day, $year)
    $start_date=gregoriantojd($date_parts1[0], $date_parts1[1], $date_parts1[2]);
    $end_date=gregoriantojd($date_parts2[0], $date_parts2[1], $date_parts2[2]);
    return $end_date - $start_date;
  }  
  
  
  public static function array_remove_value() 
  { 
    $args = func_get_args(); 
    $arr = $args[0]; 
    $values = array_slice($args,1); 
     
    foreach($arr as $k=>$v) 
    { 
      if(in_array($v, $values)) 
        unset($arr[$k]); 
    } 
    
    return $arr; 
  }
  
}
